<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./libs/vue3.js"></script>
</head>

<body>
    <div id="app">
        <!-- 
            vue3中:
            v-if指令的优先级高于v-for( v-if指令先执行, v-for指令后执行 )
         -->
        <h3 v-for="(item,index) in list1" :key="item">{{item}}</h3>
    </div>
</body>
<script>
    // 创建应用实例
    const app = Vue.createApp({
        data() {
            return {
                list: ['苹果', '香蕉', '草莓', '榴莲', '水密桃']
            }
        },
        computed:{
            list1(){
                return this.list.slice(0,3);
            }
        }
    });

    // 挂载应用实例
    app.mount('#app');
</script>

</html>